﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DOMercury.Engine;
using DOMercury.Interfaces;
using DOMercury.Items;

namespace NirCmdPlugin
{
    public class ServicesSubIndex: ISubIndex
    {
        #region ISubIndex Members

        public List<IItem> GetSubIndex(IItem item, IAction action)
        {
            List<IItem> items = new List<IItem>();
            try
            {
                foreach (System.ServiceProcess.ServiceController s in System.ServiceProcess.ServiceController.GetServices())
                {
                    items.Add(new Service(s));
                }
            }
            catch { }
            return items;
        }

        public string ParentItemType
        {
            get { return "ServicesItem"; }
        }

        public bool EnableSearch
        {
            get { return true; }
        }

        public string Name
        {
            get { return "Windows Services SubIndex"; }
        }

        public string Description
        {
            get { return "Provids a sub index for Windows Services"; }
        }

        public bool HasOptions
        {
            get { return "false"; }
        }

        public void ShowOptions()
        {
            
        }

        #endregion
    }
}
